package routers

import (
	"fmt"
	"github.com/gin-gonic/gin"
	"go-0650-blog-grom/controller"
	"go-0650-blog-grom/middlewares"
)

func PostRouterInit(r *gin.Engine) {
	postRouters := r.Group("/post")
	postRouters.GET("test", func(c *gin.Context) {
		fmt.Println("访问到: /test")
		c.String(200, "帖子模块测试请求！")
	})
	postRouters.GET("/get_postList", controller.PostController{}.PostListHandler)

	// 需要走中间件认证的请求
	postRouters.Use(middlewares.JWTAuthMiddleware())
	{
		postRouters.POST("/publish", controller.PostController{}.Publish)
	}
}
